import Drawer from '../../packages/drawer'

describe('Drawer', () => {
    it('open事件', async () => {
        const openSpy = cy.spy().as('open')
        cy.mount(Drawer, {
            propsData: {
                visible: false
            },
            listeners: {
                open: openSpy,
            },
            slots: {
                default: `<div>测试内容</div>`
            }
        })
        cy.get('@vue').invoke('setProps', {
            visible: true
        })        
        cy.get('@open').should('have.been.called')


        cy.mount(Drawer, {
            propsData: {
                visible: true
            },
            listeners: {
                open: openSpy,
            },
            slots: {
                default: `<div>测试内容</div>`
            }
        })
        cy.get('@open').should('have.been.calledTwice')
    })
    
})